<html>
    <head>
    <link rel="stylesheet" href="lmm.css" type="text/css" />
    </head>
<body class="lmm">
<!-- This file is part of the Lisp Machine manual.	-*-Text-*- -->

<div class='section' id='32.1'>32.1 The Lisp Top Level</div>
	These functions constitute the Lisp top level,
and its associated functions.

[This whole section needs to be rewritten.]

<div class='defun' id='si:lisp-top-level'>
  <font class='exdent'>
    <font class='funcname'>si:lisp-top-level </font>
    <font class='italic' color='purple'></font>
  </font><br>
This is the first function called in the initial Lisp environment.
It calls <!-- open: 1, close: 0 --><font class="lisp">lisp-reinitialize</font><!-- open: 1, close: 1 --> <!-- MATCHED MATCHED MATCHED -->, clears the screen, and calls <!-- open: 2, close: 1 --><font class="lisp">si:lisp-top-level1</font><!-- open: 2, close: 2 --> <!-- MATCHED MATCHED MATCHED -->.
</div>

<div class='defun' id='lisp-reinitialize'>
  <font class='exdent'>
    <font class='funcname'>lisp-reinitialize </font>
    <font class='italic' color='purple'></font>
  </font><br>
This function does a wide variety of things, such as resetting the values
of various global constants and initializing the error system.
</div>

<div class='defun' id='si:lisp-top-level1'>
  <font class='exdent'>
    <font class='funcname'>si:lisp-top-level1 </font>
    <font class='italic' color='purple'></font>
  </font><br>
This is the actual top level loop.  It prints out "<!-- open: 3, close: 2 --><font class="lisp">105 FOOBAR</font><!-- open: 3, close: 3 --> <!-- MATCHED MATCHED MATCHED -->" and
then goes into a loop reading a form from <!-- open: 4, close: 3 --><font class="lisp">standard-input</font><!-- open: 4, close: 4 --> <!-- MATCHED MATCHED MATCHED -->,
evaluating it, and printing the result (with slashification) to
<!-- open: 5, close: 4 --><font class="lisp">standard-output</font><!-- open: 5, close: 5 --> <!-- MATCHED MATCHED MATCHED -->.  If several values are returned by the form
all of them will be printed.  Also the values of <!-- open: 6, close: 5 --><font class="lisp">*</font><!-- open: 6, close: 6 --> <!-- MATCHED MATCHED MATCHED -->, <!-- open: 7, close: 6 --><font class="lisp">+</font><!-- open: 7, close: 7 --> <!-- MATCHED MATCHED MATCHED -->, <!-- open: 8, close: 7 --><font class="lisp">-</font><!-- open: 8, close: 8 --> <!-- MATCHED MATCHED MATCHED -->, <!-- open: 9, close: 8 --><font class="lisp">//</font><!-- open: 9, close: 9 --> <!-- MATCHED MATCHED MATCHED -->,
<!-- open: 10, close: 9 --><font class="lisp">++</font><!-- open: 10, close: 10 --> <!-- MATCHED MATCHED MATCHED -->, <!-- open: 11, close: 10 --><font class="lisp">**</font><!-- open: 11, close: 11 --> <!-- MATCHED MATCHED MATCHED -->, <!-- open: 12, close: 11 --><font class="lisp">+++</font><!-- open: 12, close: 12 --> <!-- MATCHED MATCHED MATCHED -->, and <!-- open: 13, close: 12 --><font class="lisp">***</font><!-- open: 13, close: 13 --> <!-- MATCHED MATCHED MATCHED -->
are maintained (see below).
</div>

<div class='defspec' id='break'><font class='exdent'><font class='funcname' id='break'>break</font><font class="italic"> Special Form</font></br></font><!-- end font_exdent --><!-- open: 14, close: 13 --><font class="lisp">break</font><!-- open: 14, close: 14 --> <!-- MATCHED MATCHED MATCHED --> is used to enter a breakpoint loop, which is similar
to a Lisp top level loop.  <!-- open: 15, close: 14 --><font class="lisp">(break <!-- open: 16, close: 14 --><font class="italic">tag</font><!-- open: 16, close: 15 -->)</font><!-- open: 16, close: 16 --> <!-- MATCHED MATCHED MATCHED --> will always
enter the loop; <!-- open: 17, close: 16 --><font class="lisp">(break <!-- open: 18, close: 16 --><font class="italic">tag</font><!-- open: 18, close: 17 --> <!-- open: 19, close: 17 --><font class="italic">conditional-form</font><!-- open: 19, close: 18 -->)</font><!-- open: 19, close: 19 --> <!-- MATCHED MATCHED MATCHED -->
will evaluate <!-- open: 20, close: 19 --><font class="italic">conditional-form</font><!-- open: 20, close: 20 --> <!-- MATCHED MATCHED MATCHED --> and only enter the break loop
if it returns non-<!-- open: 21, close: 20 --><font class="lisp">nil</font><!-- open: 21, close: 21 --> <!-- MATCHED MATCHED MATCHED -->.  If the break loop is entered, <!-- open: 22, close: 21 --><font class="lisp">break</font><!-- open: 22, close: 22 --> <!-- MATCHED MATCHED MATCHED -->
prints out
<pre class='lisp'>
;bkpt <!-- open: 23, close: 22 --><font class="italic">tag</font><!-- open: 23, close: 23 --> <!-- MATCHED MATCHED MATCHED -->
</pre>
and then enters a loop reading, evaluating, and printing forms.
A difference between a break loop and the top level loop
is that after reading a form, <!-- open: 24, close: 23 --><font class="lisp">break</font><!-- open: 24, close: 24 --> <!-- MATCHED MATCHED MATCHED --> checks for the
following special cases: if the symbol <!-- open: 25, close: 24 --><font class="lisp">&loz;g</font><!-- open: 25, close: 25 --> <!-- MATCHED MATCHED MATCHED --> is typed,
<!-- open: 26, close: 25 --><font class="lisp">break</font><!-- open: 26, close: 26 --> <!-- MATCHED MATCHED MATCHED --> throws back to the Lisp top level.  If <!-- open: 27, close: 26 --><font class="lisp">&loz;p</font><!-- open: 27, close: 27 --> <!-- MATCHED MATCHED MATCHED -->
is typed, <!-- open: 28, close: 27 --><font class="lisp">break</font><!-- open: 28, close: 28 --> <!-- MATCHED MATCHED MATCHED --> returns <!-- open: 29, close: 28 --><font class="lisp">nil</font><!-- open: 29, close: 29 --> <!-- MATCHED MATCHED MATCHED -->.  If <!-- open: 30, close: 29 --><font class="lisp">(return <!-- open: 31, close: 29 --><font class="italic">form</font><!-- open: 31, close: 30 -->)</font><!-- open: 31, close: 31 --> <!-- MATCHED MATCHED MATCHED -->
is typed, <!-- open: 32, close: 31 --><font class="lisp">break</font><!-- open: 32, close: 32 --> <!-- MATCHED MATCHED MATCHED --> evaluates <!-- open: 33, close: 32 --><font class="italic">form</font><!-- open: 33, close: 33 --> <!-- MATCHED MATCHED MATCHED --> and returns the result.
</div>

<div class='defvar' id='-'><font class='exdent'><font class='funcname' id='-'>-</font><font class="italic"> Variable</font><br></font><!-- end font_exdent -->While a form is being evaluated by a read-eval-print loop,
<!-- open: 34, close: 33 --><font class="lisp">-</font><!-- open: 34, close: 34 --> <!-- MATCHED MATCHED MATCHED --> is bound to the form itself.
</div>

<div class='defvar' id='+'><font class='exdent'><font class='funcname' id='+'>+</font><font class="italic"> Variable</font><br></font><!-- end font_exdent -->While a form is being evaluated by a read-eval-print loop,
<!-- open: 35, close: 34 --><font class="lisp">+</font><!-- open: 35, close: 35 --> <!-- MATCHED MATCHED MATCHED --> is bound to the previous form that was read by the loop.
</div>

<div class='defvar' id='*'><font class='exdent'><font class='funcname' id='*'>*</font><font class="italic"> Variable</font><br></font><!-- end font_exdent -->While a form is being evaluated by a read-eval-print loop,
<!-- open: 36, close: 35 --><font class="lisp">*</font><!-- open: 36, close: 36 --> <!-- MATCHED MATCHED MATCHED --> is bound to the result printed the last time through
the loop.  If there were several values printed (because
of a multiple-value return), <!-- open: 37, close: 36 --><font class="lisp">*</font><!-- open: 37, close: 37 --> <!-- MATCHED MATCHED MATCHED --> is bound to the first
value.
</div>

<div class='defvar' id='//'><font class='exdent'><font class='funcname' id='//'>//</font><font class="italic"> Variable</font><br></font><!-- end font_exdent -->While a form is being evaluated by a read-eval-print loop,
<!-- open: 38, close: 37 --><font class="lisp">//</font><!-- open: 38, close: 38 --> <!-- MATCHED MATCHED MATCHED --> is bound to a list of the results printed the last
time through the loop.
</div>

<div class='defvar' id='++'><font class='exdent'><font class='funcname' id='++'>++</font><font class="italic"> Variable</font><br></font><!-- end font_exdent --><!-- open: 39, close: 38 --><font class="lisp">++</font><!-- open: 39, close: 39 --> <!-- MATCHED MATCHED MATCHED --> holds the previous value of <!-- open: 40, close: 39 --><font class="lisp">+</font><!-- open: 40, close: 40 --> <!-- MATCHED MATCHED MATCHED -->, that is, the form evaluated
two interactions ago.
</div>

<div class='defvar' id='+++'><font class='exdent'><font class='funcname' id='+++'>+++</font><font class="italic"> Variable</font><br></font><!-- end font_exdent --><!-- open: 41, close: 40 --><font class="lisp">+++</font><!-- open: 41, close: 41 --> <!-- MATCHED MATCHED MATCHED --> holds the previous value of <!-- open: 42, close: 41 --><font class="lisp">++</font><!-- open: 42, close: 42 --> <!-- MATCHED MATCHED MATCHED -->.
</div>

<div class='defvar' id='**'><font class='exdent'><font class='funcname' id='**'>**</font><font class="italic"> Variable</font><br></font><!-- end font_exdent --><!-- open: 43, close: 42 --><font class="lisp">**</font><!-- open: 43, close: 43 --> <!-- MATCHED MATCHED MATCHED --> holds the previous value of <!-- open: 44, close: 43 --><font class="lisp">*</font><!-- open: 44, close: 44 --> <!-- MATCHED MATCHED MATCHED -->, that is, the result of the
form evaluated two interactions ago.
</div>

<div class='defvar' id='***'><font class='exdent'><font class='funcname' id='***'>***</font><font class="italic"> Variable</font><br></font><!-- end font_exdent --><!-- open: 45, close: 44 --><font class="lisp">***</font><!-- open: 45, close: 45 --> <!-- MATCHED MATCHED MATCHED --> holds the previous value of <!-- open: 46, close: 45 --><font class="lisp">**</font><!-- open: 46, close: 46 --> <!-- MATCHED MATCHED MATCHED -->.
</div>

<div class='defvar' id='lisp-initialization-list'><font class='exdent'><font class='funcname' id='lisp-initialization-list'>lisp-initialization-list</font><font class="italic"> Variable</font><br></font><!-- end font_exdent -->The value of <!-- open: 47, close: 46 --><font class="lisp">lisp-initialization-list</font><!-- open: 47, close: 47 --> <!-- MATCHED MATCHED MATCHED --> is a list of forms, which
are sequentially evaluated by <!-- open: 48, close: 47 --><font class="lisp">lisp-reinitialize</font><!-- open: 48, close: 48 --> <!-- MATCHED MATCHED MATCHED -->.
</div>

<div class='defvar' id='lisp-crash-list'><font class='exdent'><font class='funcname' id='lisp-crash-list'>lisp-crash-list</font><font class="italic"> Variable</font><br></font><!-- end font_exdent -->The value of <!-- open: 49, close: 48 --><font class="lisp">lisp-crash-list</font><!-- open: 49, close: 49 --> <!-- MATCHED MATCHED MATCHED --> is a list of forms.
<!-- open: 50, close: 49 --><font class="lisp">lisp-reinitialize</font><!-- open: 50, close: 50 --> <!-- MATCHED MATCHED MATCHED --> sequentially evaluates these
forms, and then sets <!-- open: 51, close: 50 --><font class="lisp">lisp-crash-list</font><!-- open: 51, close: 51 --> <!-- MATCHED MATCHED MATCHED --> to <!-- open: 52, close: 51 --><font class="lisp">nil</font><!-- open: 52, close: 52 --> <!-- MATCHED MATCHED MATCHED -->.
</div>

<div class='section' id='32.2'>32.2 Logging In</div>
	Logging in tells the Lisp Machine who you are, so that
other users can see who is logged in, you can receive messages,
and your INIT file can be run.  An INIT file is a Lisp program
which gets loaded when you log in; it can be used to set up
a personalized environment.  The init file is named <!-- open: 53, close: 52 --><font class="italic">user</font><!-- open: 53, close: 53 --> <!-- MATCHED MATCHED MATCHED -->; .LISPM (INIT)
if you have a directory.

	When you log out, it should be possible to undo any
personalizations you have made so that they do not affect the next user
of the machine.  Therefore, anything done by an INIT file should be
undoable.  In order to do this, for every form in the INIT file, a Lisp
form to undo its effects should be added to the list which is the value
of <!-- open: 54, close: 53 --><font class="lisp">logout-list</font><!-- open: 54, close: 54 --> <!-- MATCHED MATCHED MATCHED -->.  The functions <!-- open: 55, close: 54 --><font class="lisp">login-setq</font><!-- open: 55, close: 55 --> <!-- MATCHED MATCHED MATCHED --> and <!-- open: 56, close: 55 --><font class="lisp">login-eval</font><!-- open: 56, close: 56 --> <!-- MATCHED MATCHED MATCHED -->
help make this easy; see below.

<div class='defvar' id='user-id'><font class='exdent'><font class='funcname' id='user-id'>user-id</font><font class="italic"> Variable</font><br></font><!-- end font_exdent -->The value of <!-- open: 57, close: 56 --><font class="lisp">user-id</font><!-- open: 57, close: 57 --> <!-- MATCHED MATCHED MATCHED --> is either the name of the logged in user, as a string,
or else an empty string if there is no user logged in.
It appears in the who-line.
</div>

<div class='defvar' id='logout-list'><font class='exdent'><font class='funcname' id='logout-list'>logout-list</font><font class="italic"> Variable</font><br></font><!-- end font_exdent -->The value of <!-- open: 58, close: 57 --><font class="lisp">logout-list</font><!-- open: 58, close: 58 --> <!-- MATCHED MATCHED MATCHED --> is a list of forms which are evaluated
when a user logs out.
</div>

<div class='defun' id='login'>
  <font class='exdent'>
    <font class='funcname'>login </font>
    <font class='italic' color='purple'>name</font>
  </font><br>
If anyone is logged into the machine, <!-- open: 59, close: 58 --><font class="lisp">login</font><!-- open: 59, close: 59 --> <!-- MATCHED MATCHED MATCHED --> logs him out.
(See <!-- open: 60, close: 59 --><font class="lisp">logout</font><!-- open: 60, close: 60 --> <!-- MATCHED MATCHED MATCHED -->.)
Then <!-- open: 61, close: 60 --><font class="lisp">user-id</font><!-- open: 61, close: 61 --> <!-- MATCHED MATCHED MATCHED --> is set from <!-- open: 62, close: 61 --><font class="italic">name</font><!-- open: 62, close: 62 --> <!-- MATCHED MATCHED MATCHED -->.
Finally <!-- open: 63, close: 62 --><font class="lisp">login</font><!-- open: 63, close: 63 --> <!-- MATCHED MATCHED MATCHED --> attempts to find your INIT file.
It first looks in "<!-- open: 64, close: 63 --><font class="italic">user-id</font><!-- open: 64, close: 64 --> <!-- MATCHED MATCHED MATCHED -->; .LISPM (INIT)",
then in "(INIT); <!-- open: 65, close: 64 --><font class="italic">user-id</font><!-- open: 65, close: 65 --> <!-- MATCHED MATCHED MATCHED --> .LISPM",
and finally in the default init file "(INIT); * .LISPM".
When it finds one of these that exists, it loads it in.
<!-- open: 66, close: 65 --><font class="lisp">login</font><!-- open: 66, close: 66 --> <!-- MATCHED MATCHED MATCHED --> returns <!-- open: 67, close: 66 --><font class="lisp">t</font><!-- open: 67, close: 67 --> <!-- MATCHED MATCHED MATCHED -->.
</div>

<div class='defun' id='logout'>
  <font class='exdent'>
    <font class='funcname'>logout </font>
    <font class='italic' color='purple'>name</font>
  </font><br>
First, <!-- open: 68, close: 67 --><font class="lisp">logout</font><!-- open: 68, close: 68 --> <!-- MATCHED MATCHED MATCHED --> evaluates the forms on <!-- open: 69, close: 68 --><font class="lisp">logout-list</font><!-- open: 69, close: 69 --> <!-- MATCHED MATCHED MATCHED -->.
Then it tries to find a file to run, looking
first in "<!-- open: 70, close: 69 --><font class="italic">user-id</font><!-- open: 70, close: 70 --> <!-- MATCHED MATCHED MATCHED -->; .LSPM_ (INIT)",
then in "(INIT); <!-- open: 71, close: 70 --><font class="italic">user-id</font><!-- open: 71, close: 71 --> <!-- MATCHED MATCHED MATCHED --> .LSPM_",
and finally in the default file "(INIT); * .LSPM_".
If and when it finds one it these that exists, it loads it in.
Then it sets <!-- open: 72, close: 71 --><font class="lisp">user-id</font><!-- open: 72, close: 72 --> <!-- MATCHED MATCHED MATCHED --> to an empty string and <!-- open: 73, close: 72 --><font class="lisp">logout-list</font><!-- open: 73, close: 73 --> <!-- MATCHED MATCHED MATCHED -->
to <!-- open: 74, close: 73 --><font class="lisp">nil</font><!-- open: 74, close: 74 --> <!-- MATCHED MATCHED MATCHED -->, and returns <!-- open: 75, close: 74 --><font class="lisp">t</font><!-- open: 75, close: 75 --> <!-- MATCHED MATCHED MATCHED -->.
</div>

<div class='defspec' id='login-setq'><font class='exdent'><font class='funcname' id='login-setq'>login-setq</font><font class="italic"> Special Form</font></br></font><!-- end font_exdent --><!-- open: 76, close: 75 --><font class="lisp">login-setq</font><!-- open: 76, close: 76 --> <!-- MATCHED MATCHED MATCHED --> is like <!-- open: 77, close: 76 --><font class="lisp">setq</font><!-- open: 77, close: 77 --> <!-- MATCHED MATCHED MATCHED --> except that it puts
a <!-- open: 78, close: 77 --><font class="lisp">setq</font><!-- open: 78, close: 78 --> <!-- MATCHED MATCHED MATCHED --> form on <!-- open: 79, close: 78 --><font class="lisp">logout-list</font><!-- open: 79, close: 79 --> <!-- MATCHED MATCHED MATCHED --> to set the variables
to their previous values.
</div>

<div class='defun' id='login-eval'>
  <font class='exdent'>
    <font class='funcname'>login-eval </font>
    <font class='italic' color='purple'>x</font>
  </font><br>
<!-- open: 80, close: 79 --><font class="lisp">login-eval</font><!-- open: 80, close: 80 --> <!-- MATCHED MATCHED MATCHED --> is used for functions which are "meant to be called"
from INIT files, such as <!-- open: 81, close: 80 --><font class="lisp">eine:ed-redefine-keys</font><!-- open: 81, close: 81 --> <!-- MATCHED MATCHED MATCHED -->, which conveniently
return a form to undo what they did.  <!-- open: 82, close: 81 --><font class="lisp">login-eval</font><!-- open: 82, close: 82 --> <!-- MATCHED MATCHED MATCHED --> adds
the result of the form <!-- open: 83, close: 82 --><font class="italic">x</font><!-- open: 83, close: 83 --> <!-- MATCHED MATCHED MATCHED --> to the <!-- open: 84, close: 83 --><font class="lisp">logout-list</font><!-- open: 84, close: 84 --> <!-- MATCHED MATCHED MATCHED -->.
</div>
<!-- eof -->
</body>
</html>

